<?php
require_once dirname(__FILE__) . '/../../common.inc.php';
require_once dirname(__FILE__) . '/Plugin.class.php';
$obj = new Plugin();
$myPdo = DbUtils::createPdoInst();

try {
  $plugin = new stdClass();
  $plugin->track_id = MiscUtils::unique();
  $plugin->name = $obj->name;
  $plugin->folder = $obj->folder;
  DbUtils::add($myPdo, 'pz_plugin', $plugin);
} catch (PDOException $e) {
  echo $e->getMessage();
  return;
}

try {
  $sql = "CREATE TABLE IF NOT EXISTS `" . TABLE_NAME_PREFIX_PLUGIN . $obj->folder . "_config`(
           `id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
           `instance_id` int,
           `title` varchar(45),
           `input_type` varchar(16),
           `width` int,
           `height` int,
           `nessary` BOOLEAN
          )";
  $myPdo->exec($sql);
  $sql2 = "CREATE TABLE IF NOT EXISTS `" . TABLE_NAME_PREFIX_PLUGIN . $obj->folder . "_email`(
  `id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `instance_id` int,
  `mail_to` varchar(45),
  `smtp_secure` varchar(16),
  `host` varchar(45),
  `port` int,
  `username` varchar(45),
  `password` varchar(45),
  `mail_from` varchar(45),
  `sender_name` varchar(45),
  `subject` varchar(45),
  `recepter_name` varchar(45),
  `f_bgcolor` varchar(16),
  `f_color` varchar(16),
  `text_border` varchar(16),
  `f_font` varchar(45),
  `f_size` int,
  `f_weight` varchar(16),
  `cellpadding` int,
  `b_text` varchar(16),
  `b_width` int,
  `b_height` int,
  `b_bgcolor` varchar(16),
  `b_color` varchar(16),
  `b_font` varchar(16),
  `b_size` int,
  `b_weight` varchar(16),
  `f_bgcolor_tran` BOOLEAN
  )";
  $myPdo->exec($sql2);
  echo 'Completed Successfully.';
} catch (PDOException $e) {
  echo $e->getMessage();
}
?>